// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

/**
 * 事件和自定义事件
 */

const {ccclass, property} = cc._decorator;

const { TOUCH_START } = cc.Node.EventType;
const { KEY_DOWN } = cc.SystemEvent.EventType;

const ON_FIRE = 'onfire'

@ccclass
export default class NewClass extends cc.Component {

    onLoad () {
        // this.node.on(ON_FIRE, function(msg){
        //     cc.log(msg)
        // })
        
        // const ln = this.node.getChildByName('Btn')
        // const nln = cc.instantiate(ln)
        // nln.parent = this.node;
        // nln.setPosition(0, 0)
        
    }

    onEnable(){}

    start () {
        // const msgFordispatchEvent = new cc.Event.EventCustom(ON_FIRE, true)
        // msgFordispatchEvent.detail = 'bbb'
        // this.node.emit(ON_FIRE, 'aaa')
        // this.node.dispatchEvent(msgFordispatchEvent)
        // this.schedule(() => {
        //     this.node.emit(ON_FIRE, 'aaa')
        //     this.node.dispatchEvent(msgFordispatchEvent)
        // }, 1)
    }

    // update (dt) {}

    lateUpdate(){}

    onDisable(){}

    onDestroy(){}

}
